package com.xu.sms.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

import javax.servlet.MultipartConfigElement;

/**
 * @author xupenghao@163.com
 * @date 2018-06-05 21:40
 */
@Configuration
public class ConfigSms {


    //文件上传的配置
    @Bean
    public MultipartConfigElement multipartConfigElement(){
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //单个数据大小 3M
        factory.setMaxFileSize("3MB");
        //上传总数据大小5M
        factory.setMaxRequestSize("5MB");
      //  factory.setFileSizeThreshold(0);
        //修改临时文件目录
        //factory.setLocation("/upload/img");
        return factory.createMultipartConfig();
    }

  //  public void

}
